<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="../common.jsp"></jsp:include>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport" />
  <link href="${pageContext.request.contextPath}/Lanai/css/lanai-ui.css" rel="stylesheet" />
  <script type="text/javascript" src="${pageContext.request.contextPath}/js/md5.js"></script>
</head>

<body style="height: 50%;">
  <div class="lockscreen">
    <div class="lockscreen-wrapper" style="width: 22%;min-width: 220px;">
      <div class="lockscreen-logo">
        <a href="#"><b>备品备件管理系统</a>
      </div>
      <form  class="bs-example bs-example-form" role="form">
            <!--class="form-control"  带样式换行-->
          <div class="input-group">
            <span  class="input-group-addon" style="background-color: #d2d6de;">用户名：</span>
            <input id="tbx_lock_name" type="text" class="form-control"  placeholder="请输入用户名">
          </div>
          <br/>
          <div class="input-group">
            <span  class="input-group-addon" style="background-color: #d2d6de;">密&nbsp;&nbsp;&nbsp;码：</span>
            <input id="tbx_lock_password" type="password" class="form-control"  placeholder="请输入密码">
          </div>
          <div id="nameerr" style="color: red; margin-left: 90px; margin-top: 15px;margin-bottom: 10px; ">
		  </div>
          <br/>
      </form>
      
      <div class="help-block text-center">
        <!--点击根据data-widget关闭modal -->
        <button type="button" class="btn"  data-placement="top" onclick="pageGodEntry()">登录 &nbsp;<i class="fa fa-arrow-right text-muted"></i></button>
        <script>
                function pageGodEntry() {
                    var scode = $("#tbx_lock_name").val();
                    var pass = md5($("#tbx_lock_password").val());
                    
                    $.ajax({
        	            type: "POST",
        	            url:"${pageContext.request.contextPath}/login/login.do",
        	            data:"scode="+scode+"&pass="+pass,
        	            success: function(data) {
        	            	if (data == 0) {
        						$("#nameerr").show();
        						$("#nameerr").html("用户名或者密码不正确！");
        					}else {
                                location.href = "${pageContext.request.contextPath}/main.do";
/*                                 location.href = "${pageContext.request.contextPath}/login/loginTo.do"; */
        					}
        	            }
        	        }); 
                }
        </script>
      </div>
      <div class="lockscreen-footer text-center">
          &nbsp;
      </div>
    </div>
  </div>
</body>
</html>
